<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
<head> 
<title>Scuola Media E. d'Arborea - Lamarmora </title> 
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
<meta name="description" content="Il sito della scuola secondaria superiore di Iglesias, in Sardegna" /> 
<meta name="keywords" content="scuola, iglesias, didattica, insegnamento, docenti" /> 
<link rel="stylesheet" href="andreas08.css" type="text/css" media="screen,projection" /> 
<?php include $_ENV["DOCUMENT_ROOT"]."/js/prototype.php" ?>
<script type="text/javascript" src="/js/page.js"></script> 
<script type="text/javascript">
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);

var tempX = 0;
var tempY = 0;

function materia(event){
    //alert("ok");   
    document.getElementById('hid').style.display = "none";
    var uid = document.forms[0].id_ora.value;
    var mat = document.forms[0].mat.value;
    var teacher = document.forms[0].teach.value;
    var url = "http://www.scuolamediatre.it/admin/adm_classes/upd_ora.php";
    //var data = "uid="+uid+"&mat="+mat+"&teacher="+teacher;
    //alert(data);
    //httpRequest("POST", url, true, modMateria, data);
    var req = new Ajax.Request(url,
			  {
			    	method:'post',
			    	parameters: {uid: uid, mat: mat, teacher: teacher},
			    	onSuccess: function(transport){
			      		var response = transport.responseText || "no response text";
			      		if(response == "ko"){
			      			alert("Impossibile completare l'operazione richiesta. Riprovare tra qualche secondo o segnalare l'errore al webmaster");
				     		return;
			     		}
			     		else{
			     			var dati = response.split(";");
			                var materia = dati[1];
			                var id_ora = "ora"+dati[2];
			                var x = document.getElementById(id_ora);
			                x.innerHTML = "";
			                x.innerHTML = dati[1];
			     		}
			    	},
			    	onFailure: function(){ alert("Si e' verificato un errore...") }
			  });
    
}

function visualizza(e) {
	<?php 
    if(!$coordinatore){
    ?>
    //do_nothing();
    alert("Modifica permessa solamente al coordinatore della classe");
    return false;
    <?php 
    }
    else{
    ?>
    var hid = document.getElementById("hid");
    //alert(hid.style.top);
    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX + document.body.scrollLeft;
        tempY = event.clientY + document.body.scrollTop;
    } else {  // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }  
    // catch possible negative values in NS4
    if (tempX < 0){tempX = 0;}
    if (tempY < 0){tempY = 0;}  
    hid.style.top = parseInt(tempY)+"px";
    //alert(hid.style.top);
    hid.style.left = parseInt(tempX)+"px";
    hid.style.display = "inline";
    return true;
    <?php 
    }
    ?>
}

</script>
</head> 
 
<body> 
<div id="container" > 
 
<div id="header"> 
<h1>Scuola Media E. d'Arborea - Lamarmora</h1> 
<h2>area riservata ai docenti</h2> 
</div> 
<?php include "navigation.php" ?>
<div id="content"> 
<!--
    DIV nascosto che contiene le materie: ogni riga e' un link che carica materie.php
    -->
    <div id="hid" style="position: absolute; width: 220px; height: 290px; display: none; border: 1px solid; background-color: rgb(245,245,245); padding-left: 10px">
    <?php
    $k = 0;
    while(list($key, $value) = each($materie)){
    ?>
        <a style="font-weight: normal; <?php if($k%2) print('background-color: #E7E7E7') ?>" href="#" onclick="document.forms[0].mat.value = <?php print $key ?>; document.forms[0].teach.value = <?php print $value[2] ?>; materia(event); "><?php print $value[0] ?></a><br />
    <?php
        $k++;
    }
    ?>
    </div>
    <h2 style="text-align: center"><?php print "Classe ".$_SESSION['__classe__']->get_anno().$_SESSION['__classe__']->get_sezione()." - ".$_SESSION['__current_year__']->to_string() ?></h2> 
        <form method="post">
        <table width="90%" style="margin-right: auto; margin-left: auto; text-align: center; font-size: 11px" cellspacing="0">
        <tr>
            <td colspan="4" style="font-weight: bold; padding-top: 2px; font-size: 12px" align="center">Orario delle lezioni [ <a href="pdf_class_schedule.php">PDF</a> ] </td>
        </tr>
        <tr>
            <td colspan="4" style="padding-bottom: 10px">&nbsp;&nbsp;&nbsp;</td>
        </tr>
        <tr style="font-weight: bold; height: 30px">
        	<td style="width: 7%; border-top: 1px solid; border-bottom: 2px solid; border-right: 1px solid; border-left: 1px solid; border-color: #c0c0c0">Ora</td>
        	<td style="width: 31%; border-top: 1px solid; border-bottom: 2px solid; border-right: 1px solid; border-color: #c0c0c0">Luned&igrave;</td>
        	<td style="width: 31%; border-top: 1px solid; border-bottom: 2px solid; border-right: 1px solid; border-color: #c0c0c0">Marted&igrave;</td>
        	<td style="width: 31%; border-top: 1px solid; border-bottom: 2px solid; border-right: 1px solid; border-color: #c0c0c0">Mercoled&igrave;</td>
        </tr>
        <?php 
        for($i = 0; $i < $ore; $i++){
        	reset($materie);
        ?>
        <tr>
        	<td style="width: 7%; border-bottom: 1px solid; border-right: 1px solid; border-left: 1px solid; border-color: #c0c0c0"><?php print $inizio_ore[$i+1] ?></td>
        	<td style="width: 31%; border-bottom: 1px solid; border-right: 1px solid;; border-color: #c0c0c0"><a style="color: #303030;font-weight: normal" href="#" onclick="document.forms[0].id_ora.value = <?php $d = $orario_classe->searchHour("Lun", $i+1, $classe); print $d->getID() ?>; visualizza(event)" id="ora<?php $d = $orario_classe->searchHour("Lun", $i+1, $classe); print $d->getID() ?>"><?php print $materie[$orario_classe->getMateria($classe, "Lun", $i+1)][0] ?></a></td>
        	<td style="width: 31%; border-bottom: 1px solid; border-right: 1px solid;; border-color: #c0c0c0"><a style="color: #303030;font-weight: normal" href="#" onclick="document.forms[0].id_ora.value = <?php $d = $orario_classe->searchHour("Mar", $i+1, $classe); print $d->getID() ?>; visualizza(event)" id="ora<?php $d = $orario_classe->searchHour("Mar", $i+1, $classe); print $d->getID() ?>"><?php print $materie[$orario_classe->getMateria($classe, "Mar", $i+1)][0] ?></a></td>
        	<td style="width: 31%; border-bottom: 1px solid; border-right: 1px solid;; border-color: #c0c0c0"><a style="color: #303030;font-weight: normal" href="#" onclick="document.forms[0].id_ora.value = <?php $d = $orario_classe->searchHour("Mer", $i+1, $classe); print $d->getID() ?>; visualizza(event)" id="ora<?php $d = $orario_classe->searchHour("Mer", $i+1, $classe); print $d->getID() ?>"><?php print $materie[$orario_classe->getMateria($classe, "Mer", $i+1)][0] ?></a></td>
        </tr>
        <?php 
        }
        ?>
        <tr>
            <td colspan="4">&nbsp;&nbsp;&nbsp;</td>
        </tr>
        <tr style="font-weight: bold; text-align: center; height: 30px">
        	<td style="width: 7%; border-bottom: 2px solid; border-right: 1px solid; border-left: 1px solid; border-top: 1px solid; border-color: #c0c0c0">Ora</td>
        	<td style="width: 31%; border-bottom: 2px solid; border-right: 1px solid; border-top: 1px solid; border-color: #c0c0c0">Gioved&igrave;</td>
        	<td style="width: 31%; border-bottom: 2px solid; border-right: 1px solid; border-top: 1px solid; border-color: #c0c0c0">Venerd&igrave;</td>
        	<td style="width: 31%; border-bottom: 2px solid; border-right: 1px solid; border-top: 1px solid; border-color: #c0c0c0">Sabato</td>
        </tr>
        <?php 
        for($i = 0; $i < $ore; $i++){
        	reset($materie);
        ?>
        <tr>
        	<td style="width: 7%; border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid; border-color: #c0c0c0"><?php print $inizio_ore[$i+1] ?></td>
        	<td style="width: 31%; border-bottom: 1px solid; border-right: 1px solid; border-color: #c0c0c0"><a style="color: #303030;font-weight: normal" href="#" onclick="document.forms[0].id_ora.value = <?php $d = $orario_classe->searchHour("Gio", $i+1, $classe); print $d->getID() ?>; visualizza(event)" id="ora<?php $d = $orario_classe->searchHour("Gio", $i+1, $classe); print $d->getID() ?>"><?php print $materie[$orario_classe->getMateria($classe, "Gio", $i+1)][0] ?></a></td>
        	<td style="width: 31%; border-bottom: 1px solid; border-right: 1px solid; border-color: #c0c0c0"><a style="color: #303030;font-weight: normal" href="#" onclick="document.forms[0].id_ora.value = <?php $d = $orario_classe->searchHour("Ven", $i+1, $classe); print $d->getID() ?>; visualizza(event)" id="ora<?php $d = $orario_classe->searchHour("Ven", $i+1, $classe); print $d->getID() ?>"><?php print $materie[$orario_classe->getMateria($classe, "Ven", $i+1)][0] ?></a></td>
        	<td style="width: 31%; border-bottom: 1px solid; border-right: 1px solid; border-color: #c0c0c0"><a style="color: #303030;font-weight: normal" href="#" onclick="document.forms[0].id_ora.value = <?php $d = $orario_classe->searchHour("Sab", $i+1, $classe); print $d->getID() ?>; visualizza(event)" id="ora<?php $d = $orario_classe->searchHour("Sab", $i+1, $classe); print $d->getID() ?>"><?php print $materie[$orario_classe->getMateria($classe, "Sab", $i+1)][0] ?></a></td>
        </tr>
        <?php 
        }
        ?>
        <tr>
                <td colspan="4">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">&nbsp;&nbsp;&nbsp;
                	<input type="hidden" name="mat" />
                	<input type="hidden" name="teach" />
        			<input type="hidden" name="id_ora" />
                </td>
            </tr>
        </table>
        </form>

<div class="splitcontentleft"> 

<p>&nbsp;</p>
 
</div> 
 
 
</div> 
 
<div id="subcontent"> 
<?php include 'smallbox.php'; ?>
 
<?php include "class_working.php" ?>

</div> 
 
<?php include "footer.php" ?> 
 
</div> 
</body> 
</html>